<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
 <head>
  <meta http-equiv="content-type" content="text/html; charset=UTF-8">
  <title>抓取下一个结果</title>

 </head>
 <body><div class="manualnavbar" style="text-align: center;">
 <div class="prev" style="text-align: left; float: left;"><a href="memcached.deletemultibykey.html">Memcached::deleteMultiByKey</a></div>
 <div class="next" style="text-align: right; float: right;"><a href="memcached.fetchall.html">Memcached::fetchAll</a></div>
 <div class="up"><a href="class.memcached.html">Memcached</a></div>
 <div class="home"><a href="index.html">PHP Manual</a></div>
</div><hr /><div id="memcached.fetch" class="refentry">
 <div class="refnamediv">
  <h1 class="refname">Memcached::fetch</h1>
  <p class="verinfo">(PECL memcached &gt;= 0.1.0)</p><p class="refpurpose"><span class="refname">Memcached::fetch</span> &mdash; <span class="dc-title">抓取下一个结果</span></p>

 </div>

 <div class="refsect1 description" id="refsect1-memcached.fetch-description">
  <h3 class="title">说明</h3>
  <div class="methodsynopsis dc-description">
   <span class="modifier">public</span> <span class="type">array</span> <span class="methodname"><strong>Memcached::fetch</strong></span>
    ( <span class="methodparam">void</span>
   )</div>

  <p class="para rdfs-comment">
   <span class="function"><strong>Memcached::fetch()</strong></span>从最后一次请求中抓取下一个结果。
  </p>
 </div>


 <div class="refsect1 parameters" id="refsect1-memcached.fetch-parameters">
  <h3 class="title">参数</h3>
  <p class="para">此函数没有参数。</p>
 </div>


 <div class="refsect1 returnvalues" id="refsect1-memcached.fetch-returnvalues">
  <h3 class="title">返回值</h3>
  <p class="para">
   返回下一个结果或其他情况下返回<strong><code>FALSE</code></strong>。
   如果结果集已经抓取完毕，<span class="methodname"><a href="memcached.getresultcode.html" class="methodname">Memcached::getResultCode()</a></span>将返回<strong><code>Memcached::RES_END</code></strong>。
  </p>
 </div>


 <div class="refsect1 examples" id="refsect1-memcached.fetch-examples">
  <h3 class="title">范例</h3>
  <p class="para">
   <div class="example" id="example-4342">
    <p><strong>Example #1 <span class="function"><strong>Memcached::fetch()</strong></span> 示例</strong></p>
    <div class="example-contents">
<div class="phpcode"><code><span style="color: #000000">
<span style="color: #0000BB">&lt;?php<br />$m&nbsp;</span><span style="color: #007700">=&nbsp;new&nbsp;</span><span style="color: #0000BB">Memcached</span><span style="color: #007700">();<br /></span><span style="color: #0000BB">$m</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">addServer</span><span style="color: #007700">(</span><span style="color: #DD0000">'localhost'</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">11211</span><span style="color: #007700">);<br /><br /></span><span style="color: #0000BB">$m</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">set</span><span style="color: #007700">(</span><span style="color: #DD0000">'int'</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">99</span><span style="color: #007700">);<br /></span><span style="color: #0000BB">$m</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">set</span><span style="color: #007700">(</span><span style="color: #DD0000">'string'</span><span style="color: #007700">,&nbsp;</span><span style="color: #DD0000">'a&nbsp;simple&nbsp;string'</span><span style="color: #007700">);<br /></span><span style="color: #0000BB">$m</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">set</span><span style="color: #007700">(</span><span style="color: #DD0000">'array'</span><span style="color: #007700">,&nbsp;array(</span><span style="color: #0000BB">11</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">12</span><span style="color: #007700">));<br /><br /></span><span style="color: #FF8000">//延迟的获取int和array这两个key的值<br /></span><span style="color: #0000BB">$m</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">getDelayed</span><span style="color: #007700">(array(</span><span style="color: #DD0000">'int'</span><span style="color: #007700">,&nbsp;</span><span style="color: #DD0000">'array'</span><span style="color: #007700">),&nbsp;</span><span style="color: #0000BB">true</span><span style="color: #007700">);<br /></span><span style="color: #FF8000">//循环抓取上面的延迟抓取得到的结果<br /></span><span style="color: #007700">while&nbsp;(</span><span style="color: #0000BB">$result&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #0000BB">$m</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">fetch</span><span style="color: #007700">())&nbsp;{<br />&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000BB">var_dump</span><span style="color: #007700">(</span><span style="color: #0000BB">$result</span><span style="color: #007700">);<br />}<br /></span><span style="color: #0000BB">?&gt;</span>
</span>
</code></div>
    </div>

    <div class="example-contents"><p>以上例程的输出类似于：</p></div>
    <div class="example-contents screen">
<div class="cdata"><pre>
array(3) {
  [&quot;key&quot;]=&gt;
  string(3) &quot;int&quot;
  &quot;value&quot;]=&gt;
  int(99)
  [&quot;cas&quot;]=&gt;
  float(2363)
}
array(3) {
  [&quot;key&quot;]=&gt;
  string(5) &quot;array&quot;
  [&quot;value&quot;]=&gt;
  array(2) {
    [0]=&gt;
    int(11)
    [1]=&gt;
    int(12)
  }
  [&quot;cas&quot;]=&gt;
  float(2365)
}
</pre></div>
    </div>
   </div>
  </p>
 </div>


 <div class="refsect1 seealso" id="refsect1-memcached.fetch-seealso">
  <h3 class="title">参见</h3>
  <p class="para">
   <ul class="simplelist">
    <li class="member"><span class="methodname"><a href="memcached.fetchall.html" class="methodname" rel="rdfs-seeAlso">Memcached::fetchAll()</a> - 抓取所有剩余的结果</span></li>
    <li class="member"><span class="methodname"><a href="memcached.getdelayed.html" class="methodname" rel="rdfs-seeAlso">Memcached::getDelayed()</a> - 请求多个元素</span></li>
   </ul>
  </p>
 </div>


</div><hr /><div class="manualnavbar" style="text-align: center;">
 <div class="prev" style="text-align: left; float: left;"><a href="memcached.deletemultibykey.html">Memcached::deleteMultiByKey</a></div>
 <div class="next" style="text-align: right; float: right;"><a href="memcached.fetchall.html">Memcached::fetchAll</a></div>
 <div class="up"><a href="class.memcached.html">Memcached</a></div>
 <div class="home"><a href="index.html">PHP Manual</a></div>
</div></body></html>
